import * as types from '../constants/commonTypes'

const initialState = {
	isSuccess: false,
	// errMsg: '',
	serviceInfo: {
		qq: '',
		wechat: ''
	},

	homeData: {},

	isBindWx: false,

	canuseDomain: ''
}

export default function common(state = initialState, action) {
	switch (action.type) {
		// case types.SERVICE_IN_SUCCESS:
		//   return {
		//     ...state,
		//     serviceInfo: action.info,
		//     isSuccess: 'success'
		//   }
		//   break
		// case types.SERVICE_IN_ERROR:
		//   return {
		//     ...state,
		//     errMsg: action.err,
		//     isSuccess: 'err'
		//   }
		//   break
		case types.DOMAIN_IN_SUCCESS:
			return {
				...state,
				canuseDomain: action.info
			}
			break
		case types.BIND_IN_SUCCESS:
			return {
				...state,
				isBindWx: !!action.info
			}
			break
		// case types.HOME_IN_SUCCESS:
		//   return {
		//     ...state,
		//     homeData: action.info
		//   }
		//   break
		default:
			return state
	}
}
